Multidimensional array replace with close range Javascript

welcome to shbcf.ru